# Maintainer: Maxim Baz <archlinux at maximbaz dot com>
# Contributor: Peter Reschenhofer <peter.reschenhofer@gmail.com>

_pkgauthor=rfjakob
pkgname=gocryptfs
pkgver=2.4.0
pkgrel=1
pkgdesc='Encrypted overlay filesystem written in Go.'
arch=('loong64' 'x86_64')
url="https://github.com/${_pkgauthor}/${pkgname}"
license=('MIT')
depends=('glibc' 'openssl' 'fuse3')
makedepends=('go' 'pandoc' 'man-db')
source=(
    "${pkgname}-${pkgver}.tar.gz::https://github.com/${_pkgauthor}/${pkgname}/releases/download/v${pkgver}/${pkgname}_v${pkgver}_src-deps.tar.gz"
    "${pkgname}-${pkgver}.tar.gz.asc::https://github.com/${_pkgauthor}/${pkgname}/releases/download/v${pkgver}/${pkgname}_v${pkgver}_src-deps.tar.gz.asc"
)
sha256sums=('45158daf20df7f94e0c9ec57ba07af21df2e25e15b8584bf3c7de96adbbc2efd'
            'SKIP')
validpgpkeys=('FFF3E01444FED7C316A3545A895F5BC123A02740')

build() {
    cd "${srcdir}/${pkgname}_v${pkgver}_src-deps"

    export CGO_LDFLAGS="$LDFLAGS"
    export GOFLAGS="-buildmode=pie -trimpath -mod=vendor"
    make build
}

package() {
    cd "${srcdir}/${pkgname}_v${pkgver}_src-deps"
    make DESTDIR="${pkgdir}" install
}
